// index.js
const defaultAvatarUrl = 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0'
const websocket = require('./websocket').default
Page({
  async initWs(url) {
    let stompClient = await websocket.init(url, {})
    console.log('连接成功')
    stompClient.subscribe(
      "/topic/gov_nextnum_item/" ,
      (response) => {
        var responsedata = JSON.parse(response.body);
        if (responsedata != null) {
          let pushType = responsedata.pushType;
          //选房人
          if (pushType == null || pushType == 1) {
            this.socketRoomPeople(responsedata);
            //再次签到
          } else if (pushType == 2) {
            this.socketResignDeal(responsedata, false);
          } else if (pushType == 3) {
            this.responsedata.itemProgress = 4;
          }
        }
      }
    );
  },
  async onLoad() {
    this.initWs('https://test-jfbnewapi.zje.com/housekeeper/housekeeper-websocket')

  }
})